# Translation files
set(ts_files
	gui/designer/translations/ar_AR.ts
	gui/designer/translations/de_DE.ts
	gui/designer/translations/en_EN.ts
	gui/designer/translations/es_ES.ts
	gui/designer/translations/fr_FR.ts
	gui/designer/translations/hu_HU.ts
	gui/designer/translations/it_IT.ts
	gui/designer/translations/pl_PL.ts
	gui/designer/translations/pt_BR.ts
	gui/designer/translations/ru_RU.ts
	gui/designer/translations/tr_TR.ts
	gui/designer/translations/zh_CN.ts

	gui/designer/translations/qt_ar.ts
	gui/designer/translations/qt_de.ts
	gui/designer/translations/qt_es.ts
	gui/designer/translations/qt_fr.ts
	gui/designer/translations/qt_hu.ts
	gui/designer/translations/qt_it.ts
	gui/designer/translations/qt_pl.ts
	gui/designer/translations/qt_pt_BR.ts
	gui/designer/translations/qt_ru.ts
	gui/designer/translations/qt_tr.ts
	gui/designer/translations/qt_zh_CN.ts
	)
set_source_files_properties(${ts_files} PROPERTIES OUTPUT_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/translations")
configure_file(gui/designer/translations.qrc ${CMAKE_CURRENT_BINARY_DIR} COPYONLY)
qt_add_translation(qm_files ${ts_files})
add_custom_target(translations DEPENDS ${qm_files})

include(FetchContent)
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
	set(P7ZIP_SOURCE_DIR "${CMAKE_SOURCE_DIR}/src/extra/7z1900" CACHE INTERNAL "7ZIP source dir")
else()
	set(P7ZIP_SOURCE_DIR "${CMAKE_SOURCE_DIR}/src/extra/p7zip-17.04" CACHE INTERNAL "7ZIP source dir")
endif()
FetchContent_Declare(lib7zip
	SOURCE_DIR ${CMAKE_SOURCE_DIR}/src/extra/lib7zip-53abfeb
	)
FetchContent_MakeAvailable(lib7zip)

FetchContent_Declare(qkeycode
	SOURCE_DIR ${CMAKE_SOURCE_DIR}/src/extra/qkeycode
	)
FetchContent_MakeAvailable(qkeycode)

set(audio_srcs
	audio/blip_buf.c
	audio/blipbuf.c
	audio/channels.c
	audio/delay.c
	audio/handler.c
	audio/mono.c
	audio/panning.c
	audio/wave.c
	$<$<PLATFORM_ID:Linux>:
		audio/alsa/snd.c
	>
	$<$<PLATFORM_ID:FreeBSD,OpenBSD>:
		audio/sndio/snd.c
	>
	$<$<PLATFORM_ID:Windows>:
		audio/xaudio/snd.c
	>
	)

set(c++_srcs
	c++/crc/crc.cpp
	c++/crc/Crc32.cpp
	c++/l7zip/l7z.cpp
	c++/pic16c5x/pic16c5x.cpp
	c++/pic16c5x/pic16c5x_m.cpp
	c++/xBRZ/xbrz.cpp
	c++/xBRZ/xbrz_wrap.cpp
	)

set(core_srcs
	core/input/arkanoid.c
	core/input/famicom.c
	core/input/family_basic_keyboard.c
	core/input/four_score.c
	core/input/nes_001.c
	core/input/nsf_controller.c
	core/input/nsf_mouse.c
	core/input/oeka_kids_tablet.c
	core/input/snes_mouse.c
	core/input/standard_controller.c
	core/input/subor_keyboard.c
	core/input/vs.c
	core/input/zapper.c

	core/mappers/mapper_000.c
	core/mappers/mapper_001.c
	core/mappers/mapper_002.c
	core/mappers/mapper_003.c
	core/mappers/mapper_004.c
	core/mappers/mapper_005.c
	core/mappers/mapper_006.c
	core/mappers/mapper_007.c
	core/mappers/mapper_009.c
	core/mappers/mapper_010.c
	core/mappers/mapper_011.c
	core/mappers/mapper_012.c
	core/mappers/mapper_013.c
	core/mappers/mapper_014.c
	core/mappers/mapper_015.c
	core/mappers/mapper_016.c
	core/mappers/mapper_018.c
	core/mappers/mapper_019.c
	core/mappers/mapper_021.c
	core/mappers/mapper_022.c
	core/mappers/mapper_023.c
	core/mappers/mapper_024.c
	core/mappers/mapper_025.c
	core/mappers/mapper_026.c
	core/mappers/mapper_027.c
	core/mappers/mapper_028.c
	core/mappers/mapper_029.c
	core/mappers/mapper_030.c
	core/mappers/mapper_031.c
	core/mappers/mapper_032.c
	core/mappers/mapper_033.c
	core/mappers/mapper_034.c
	core/mappers/mapper_036.c
	core/mappers/mapper_037.c
	core/mappers/mapper_038.c
	core/mappers/mapper_040.c
	core/mappers/mapper_041.c
	core/mappers/mapper_042.c
	core/mappers/mapper_043.c
	core/mappers/mapper_044.c
	core/mappers/mapper_045.c
	core/mappers/mapper_046.c
	core/mappers/mapper_047.c
	core/mappers/mapper_048.c
	core/mappers/mapper_049.c
	core/mappers/mapper_050.c
	core/mappers/mapper_051.c
	core/mappers/mapper_052.c
	core/mappers/mapper_053.c
	core/mappers/mapper_055.c
	core/mappers/mapper_056.c
	core/mappers/mapper_057.c
	core/mappers/mapper_058.c
	core/mappers/mapper_059.c
	core/mappers/mapper_060.c
	core/mappers/mapper_061.c
	core/mappers/mapper_062.c
	core/mappers/mapper_063.c
	core/mappers/mapper_064.c
	core/mappers/mapper_065.c
	core/mappers/mapper_066.c
	core/mappers/mapper_067.c
	core/mappers/mapper_068.c
	core/mappers/mapper_069.c
	core/mappers/mapper_070.c
	core/mappers/mapper_071.c
	core/mappers/mapper_072.c
	core/mappers/mapper_073.c
	core/mappers/mapper_074.c
	core/mappers/mapper_075.c
	core/mappers/mapper_076.c
	core/mappers/mapper_077.c
	core/mappers/mapper_078.c
	core/mappers/mapper_079.c
	core/mappers/mapper_080.c
	core/mappers/mapper_081.c
	core/mappers/mapper_082.c
	core/mappers/mapper_083.c
	core/mappers/mapper_085.c
	core/mappers/mapper_086.c
	core/mappers/mapper_087.c
	core/mappers/mapper_088.c
	core/mappers/mapper_089.c
	core/mappers/mapper_091.c
	core/mappers/mapper_093.c
	core/mappers/mapper_094.c
	core/mappers/mapper_095.c
	core/mappers/mapper_096.c
	core/mappers/mapper_097.c
	core/mappers/mapper_099.c
	core/mappers/mapper_100.c
	core/mappers/mapper_101.c
	core/mappers/mapper_103.c
	core/mappers/mapper_104.c
	core/mappers/mapper_105.c
	core/mappers/mapper_106.c
	core/mappers/mapper_107.c
	core/mappers/mapper_108.c
	core/mappers/mapper_111.c
	core/mappers/mapper_112.c
	core/mappers/mapper_113.c
	core/mappers/mapper_114.c
	core/mappers/mapper_115.c
	core/mappers/mapper_116.c
	core/mappers/mapper_117.c
	core/mappers/mapper_118.c
	core/mappers/mapper_119.c
	core/mappers/mapper_120.c
	core/mappers/mapper_121.c
	core/mappers/mapper_123.c
	core/mappers/mapper_125.c
	core/mappers/mapper_126.c
	core/mappers/mapper_132.c
	core/mappers/mapper_133.c
	core/mappers/mapper_134.c
	core/mappers/mapper_136.c
	core/mappers/mapper_137.c
	core/mappers/mapper_138.c
	core/mappers/mapper_139.c
	core/mappers/mapper_140.c
	core/mappers/mapper_141.c
	core/mappers/mapper_142.c
	core/mappers/mapper_143.c
	core/mappers/mapper_144.c
	core/mappers/mapper_145.c
	core/mappers/mapper_147.c
	core/mappers/mapper_148.c
	core/mappers/mapper_149.c
	core/mappers/mapper_150.c
	core/mappers/mapper_152.c
	core/mappers/mapper_153.c
	core/mappers/mapper_154.c
	core/mappers/mapper_156.c
	core/mappers/mapper_157.c
	core/mappers/mapper_159.c
	core/mappers/mapper_162.c
	core/mappers/mapper_163.c
	core/mappers/mapper_164.c
	core/mappers/mapper_165.c
	core/mappers/mapper_166.c
	core/mappers/mapper_167.c
	core/mappers/mapper_168.c
	core/mappers/mapper_170.c
	core/mappers/mapper_171.c
	core/mappers/mapper_172.c
	core/mappers/mapper_173.c
	core/mappers/mapper_175.c
	core/mappers/mapper_176.c
	core/mappers/mapper_177.c
	core/mappers/mapper_178.c
	core/mappers/mapper_180.c
	core/mappers/mapper_182.c
	core/mappers/mapper_183.c
	core/mappers/mapper_184.c
	core/mappers/mapper_185.c
	core/mappers/mapper_186.c
	core/mappers/mapper_187.c
	core/mappers/mapper_188.c
	core/mappers/mapper_189.c
	core/mappers/mapper_190.c
	core/mappers/mapper_191.c
	core/mappers/mapper_192.c
	core/mappers/mapper_193.c
	core/mappers/mapper_194.c
	core/mappers/mapper_195.c
	core/mappers/mapper_196.c
	core/mappers/mapper_197.c
	core/mappers/mapper_198.c
	core/mappers/mapper_199.c
	core/mappers/mapper_200.c
	core/mappers/mapper_201.c
	core/mappers/mapper_202.c
	core/mappers/mapper_203.c
	core/mappers/mapper_204.c
	core/mappers/mapper_205.c
	core/mappers/mapper_206.c
	core/mappers/mapper_208.c
	core/mappers/mapper_209.c
	core/mappers/mapper_210.c
	core/mappers/mapper_212.c
	core/mappers/mapper_214.c
	core/mappers/mapper_215.c
	core/mappers/mapper_216.c
	core/mappers/mapper_217.c
	core/mappers/mapper_218.c
	core/mappers/mapper_219.c
	core/mappers/mapper_221.c
	core/mappers/mapper_222.c
	core/mappers/mapper_225.c
	core/mappers/mapper_226.c
	core/mappers/mapper_227.c
	core/mappers/mapper_228.c
	core/mappers/mapper_229.c
	core/mappers/mapper_230.c
	core/mappers/mapper_231.c
	core/mappers/mapper_232.c
	core/mappers/mapper_233.c
	core/mappers/mapper_234.c
	core/mappers/mapper_235.c
	core/mappers/mapper_236.c
	core/mappers/mapper_237.c
	core/mappers/mapper_238.c
	core/mappers/mapper_240.c
	core/mappers/mapper_241.c
	core/mappers/mapper_242.c
	core/mappers/mapper_244.c
	core/mappers/mapper_245.c
	core/mappers/mapper_246.c
	core/mappers/mapper_249.c
	core/mappers/mapper_250.c
	core/mappers/mapper_252.c
	core/mappers/mapper_254.c
	core/mappers/mapper_256.c
	core/mappers/mapper_259.c
	core/mappers/mapper_260.c
	core/mappers/mapper_261.c
	core/mappers/mapper_262.c
	core/mappers/mapper_263.c
	core/mappers/mapper_265.c
	core/mappers/mapper_266.c
	core/mappers/mapper_267.c
	core/mappers/mapper_268.c
	core/mappers/mapper_269.c
	core/mappers/mapper_271.c
	core/mappers/mapper_272.c
	core/mappers/mapper_274.c
	core/mappers/mapper_281.c
	core/mappers/mapper_282.c
	core/mappers/mapper_283.c
	core/mappers/mapper_284.c
	core/mappers/mapper_285.c
	core/mappers/mapper_286.c
	core/mappers/mapper_287.c
	core/mappers/mapper_288.c
	core/mappers/mapper_289.c
	core/mappers/mapper_290.c
	core/mappers/mapper_291.c
	core/mappers/mapper_292.c
	core/mappers/mapper_295.c
	core/mappers/mapper_297.c
	core/mappers/mapper_298.c
	core/mappers/mapper_299.c
	core/mappers/mapper_300.c
	core/mappers/mapper_301.c
	core/mappers/mapper_302.c
	core/mappers/mapper_303.c
	core/mappers/mapper_304.c
	core/mappers/mapper_305.c
	core/mappers/mapper_306.c
	core/mappers/mapper_307.c
	core/mappers/mapper_308.c
	core/mappers/mapper_309.c
	core/mappers/mapper_311.c
	core/mappers/mapper_312.c
	core/mappers/mapper_313.c
	core/mappers/mapper_314.c
	core/mappers/mapper_315.c
	core/mappers/mapper_319.c
	core/mappers/mapper_320.c
	core/mappers/mapper_322.c
	core/mappers/mapper_323.c
	core/mappers/mapper_324.c
	core/mappers/mapper_325.c
	core/mappers/mapper_327.c
	core/mappers/mapper_328.c
	core/mappers/mapper_329.c
	core/mappers/mapper_331.c
	core/mappers/mapper_332.c
	core/mappers/mapper_333.c
	core/mappers/mapper_334.c
	core/mappers/mapper_335.c
	core/mappers/mapper_336.c
	core/mappers/mapper_337.c
	core/mappers/mapper_338.c
	core/mappers/mapper_339.c
	core/mappers/mapper_340.c
	core/mappers/mapper_341.c
	core/mappers/mapper_342.c
	core/mappers/mapper_343.c
	core/mappers/mapper_344.c
	core/mappers/mapper_345.c
	core/mappers/mapper_346.c
	core/mappers/mapper_347.c
	core/mappers/mapper_348.c
	core/mappers/mapper_349.c
	core/mappers/mapper_350.c
	core/mappers/mapper_351.c
	core/mappers/mapper_352.c
	core/mappers/mapper_353.c
	core/mappers/mapper_354.c
	core/mappers/mapper_355.c
	core/mappers/mapper_356.c
	core/mappers/mapper_357.c
	core/mappers/mapper_358.c
	core/mappers/mapper_359.c
	core/mappers/mapper_360.c
	core/mappers/mapper_361.c
	core/mappers/mapper_362.c
	core/mappers/mapper_366.c
	core/mappers/mapper_368.c
	core/mappers/mapper_369.c
	core/mappers/mapper_370.c
	core/mappers/mapper_372.c
	core/mappers/mapper_374.c
	core/mappers/mapper_375.c
	core/mappers/mapper_377.c
	core/mappers/mapper_380.c
	core/mappers/mapper_381.c
	core/mappers/mapper_382.c
	core/mappers/mapper_384.c
	core/mappers/mapper_386.c
	core/mappers/mapper_387.c
	core/mappers/mapper_388.c
	core/mappers/mapper_389.c
	core/mappers/mapper_390.c
	core/mappers/mapper_393.c
	core/mappers/mapper_394.c
	core/mappers/mapper_395.c
	core/mappers/mapper_396.c
	core/mappers/mapper_397.c
	core/mappers/mapper_398.c
	core/mappers/mapper_399.c
	core/mappers/mapper_400.c
	core/mappers/mapper_401.c
	core/mappers/mapper_403.c
	core/mappers/mapper_404.c
	core/mappers/mapper_406.c
	core/mappers/mapper_409.c
	core/mappers/mapper_410.c
	core/mappers/mapper_411.c
	core/mappers/mapper_412.c
	core/mappers/mapper_413.c
	core/mappers/mapper_414.c
	core/mappers/mapper_415.c
	core/mappers/mapper_416.c
	core/mappers/mapper_417.c
	core/mappers/mapper_420.c
	core/mappers/mapper_421.c
	core/mappers/mapper_428.c
	core/mappers/mapper_429.c
	core/mappers/mapper_431.c
	core/mappers/mapper_432.c
	core/mappers/mapper_433.c
	core/mappers/mapper_434.c
	core/mappers/mapper_436.c
	core/mappers/mapper_437.c
	core/mappers/mapper_438.c
	core/mappers/mapper_442.c
	core/mappers/mapper_446.c
	core/mappers/mapper_447.c
	core/mappers/mapper_451.c
	core/mappers/mapper_452.c
	core/mappers/mapper_455.c
	core/mappers/mapper_456.c
	core/mappers/mapper_457.c
	core/mappers/mapper_471.c
	core/mappers/mapper_481.c
	core/mappers/mapper_512.c
	core/mappers/mapper_513.c
	core/mappers/mapper_516.c
	core/mappers/mapper_518.c
	core/mappers/mapper_517.c
	core/mappers/mapper_519.c
	core/mappers/mapper_521.c
	core/mappers/mapper_522.c
	core/mappers/mapper_524.c
	core/mappers/mapper_525.c
	core/mappers/mapper_526.c
	core/mappers/mapper_527.c
	core/mappers/mapper_528.c
	core/mappers/mapper_529.c
	core/mappers/mapper_530.c
	core/mappers/mapper_532.c
	core/mappers/mapper_538.c
	core/mappers/mapper_539.c
	core/mappers/mapper_541.c
	core/mappers/mapper_543.c
	core/mappers/mapper_547.c
	core/mappers/mapper_550.c
	core/mappers/mapper_554.c
	core/mappers/mapper_555.c
	core/mappers/mapper_556.c
	core/mappers/mapper_557.c
	core/mappers/mapper_558.c
	core/mappers/mapper_559.c
	core/mappers/mapper_560.c
	core/mappers/mapper_561.c
	core/mappers/mapper_562.c
	core/mappers/mapper_564.c
	core/mappers/mapper_FDS.c
	core/mappers/mapper_GameGenie.c
	core/mappers/mapper_NSF.c

	core/mappers/butterworth.cpp
	core/mappers/butterworth_interface.cpp
	core/mappers/EE93Cx6.c
	core/mappers/FCG.c
	core/mappers/FME7.c
	core/mappers/hc55516.cpp
	core/mappers/hc55516_interface.cpp
	core/mappers/JV001.c
	core/mappers/JYASIC.c
	core/mappers/KS202.c
	core/mappers/LZ93D50.c
	core/mappers/MMC1.c
	core/mappers/MMC2.c
	core/mappers/MMC3.c
	core/mappers/MMC4.c
	core/mappers/N118.c
	core/mappers/OneBus.c
	extra/emu2413/emu2413.c
	core/mappers/serial_devices.cpp
	core/mappers/serial_devices_interface.cpp
	core/mappers/SST39SF040.c
	core/mappers/TXC.c
	core/mappers/upd7756.cpp
	core/mappers/upd7756_interface.cpp
	core/mappers/VRC2and4.c
	core/mappers/VRC6.c
	core/mappers/VRC7.c
	core/mappers/VRC7_snd.c
	core/mappers/waveFile.cpp
	core/mappers/wave_file_interface.cpp

	core/apu.c
	core/bck_states.c
	core/cheat.c
	core/cpu.c
	core/detach_barcode.c
	core/emu.c
	core/emu_thread.c
	core/external_calls.c
	core/fds.c
	core/fps.c
	core/ines.c
	core/input.c
	core/irqA12.c
	core/irql2f.c
	core/jstick.c
	core/main.c
	core/mappers.c
	core/nes.c
	core/nsf.c
	core/nsfe.c
	core/overscan.c
	core/palette.c
	core/patcher.c
	core/patcher_xdelta3_wrap.c
	core/ppu.c
	$<$<BOOL:${ENABLE_FFMPEG}>:core/recording.c>
	core/rewind.c
	core/rom_mem.c
	core/save_slot.c
	core/sha1.c
	core/tape_data_recorder.c
	core/uncompress.c
	core/unif.c
	core/vector.c
	core/memmap.c
	)

set(extra_srcs
	extra/filter-c/filter.c
	extra/kissfft/kiss_fft.c
	extra/singleapplication/singleapplication.cpp
	extra/singleapplication/singleapplication_p.cpp
	)

set(gui_ui_srcs
	gui/designer/dlgCfgNSCode.ui
	gui/designer/dlgCmdLineHelp.ui
	gui/designer/dlgDetachBarcode.ui
	gui/designer/dlgDipswitch.ui
	gui/designer/dlgHeaderEditor.ui
	gui/designer/dlgJsc.ui
	gui/designer/dlgKeyboard.ui
	gui/designer/dlgLog.ui
	gui/designer/dlgSettings.ui
	gui/designer/dlgStdPad.ui
	gui/designer/dlgUncomp.ui
	gui/designer/dlgVsSystem.ui
	gui/designer/dlgWizard.ui
	gui/designer/mainWindow.ui
	gui/designer/wdgAPUChannels.ui
	gui/designer/wdgCheatsEditor.ui
	gui/designer/wdgKeyboardFB.ui
	gui/designer/wdgKeyboardSubor.ui
	gui/designer/wdgNTSCFilter.ui
	gui/designer/wdgNTSCBisqwitFilter.ui
	gui/designer/wdgNTSCLMP88959Filter.ui
	gui/designer/wdgNTSCNESRGBLMP88959Filter.ui
	gui/designer/wdgOverlayUi.ui
	gui/designer/wdgPALLMP88959Filter.ui
	gui/designer/wdgPALNESRGBLMP88959Filter.ui
	gui/designer/wdgPaletteEditor.ui
	gui/designer/wdgRewind.ui
	gui/designer/wdgRotateScreen.ui
	gui/designer/wdgSettingsAudio.ui
	gui/designer/wdgSettingsCheats.ui
	gui/designer/wdgSettingsGeneral.ui
	gui/designer/wdgSettingsInput.ui
	gui/designer/wdgSettingsPPU.ui
	gui/designer/wdgSettingsRecording.ui
	gui/designer/wdgSettingsVideo.ui
	gui/designer/wdgState.ui
	gui/designer/wdgTitleBar.ui
	gui/designer/wdgTitleBarWindow.ui
	gui/designer/resources.qrc
	)

set(gui_srcs
	# N.B: Include here both cpp and hpp files since automoc relies on both types
	gui/cgp.cpp
	gui/cmd_line.cpp
	gui/dipswitch.cpp
	gui/dlgAbout.cpp
	gui/dlgAbout.hpp
	gui/dlgCmdLineHelp.cpp
	gui/dlgCmdLineHelp.hpp
	gui/dlgDetachBarcode.cpp
	gui/dlgDetachBarcode.hpp
	gui/dlgDipswitch.cpp
	gui/dlgDipswitch.hpp
	gui/dlgHeaderEditor.cpp
	gui/dlgHeaderEditor.hpp
	gui/dlgJsc.cpp
	gui/dlgJsc.hpp
	gui/dlgKeyboard.cpp
	gui/dlgKeyboard.hpp
	gui/dlgLog.cpp
	gui/dlgLog.hpp
	gui/dlgSettings.cpp
	gui/dlgSettings.hpp
	gui/dlgStdPad.cpp
	gui/dlgStdPad.hpp
	gui/dlgUncomp.cpp
	gui/dlgUncomp.hpp
	gui/dlgVsSystem.cpp
	gui/dlgVsSystem.hpp
	gui/dlgWizard.cpp
	gui/dlgWizard.hpp
	gui/draw_on_screen.cpp
	gui/mainApplication.cpp
	gui/mainApplication.hpp
	gui/mainWindow.cpp
	gui/mainWindow.hpp
	gui/nes20db.cpp
	gui/objCheat.cpp
	gui/objCheat.hpp
	gui/objSettings.cpp
	gui/objSettings.hpp
	gui/qt.cpp
	gui/recentFiles.cpp
	gui/recentFiles.hpp
	gui/recent_files.cpp
	gui/settings.cpp
	gui/tas.cpp
	gui/wdgAPUChannels.cpp
	gui/wdgAPUChannels.hpp
	gui/wdgCheatsEditor.cpp
	gui/wdgCheatsEditor.hpp
	gui/wdgMenuBar.cpp
	gui/wdgMenuBar.hpp
	gui/wdgNTSCFilter.cpp
	gui/wdgNTSCFilter.hpp
	gui/wdgOverlayUi.cpp
	gui/wdgOverlayUi.hpp
	gui/wdgPaletteEditor.cpp
	gui/wdgPaletteEditor.hpp
	gui/wdgRewind.cpp
	gui/wdgRewind.hpp
	gui/wdgRotateScreen.cpp
	gui/wdgRotateScreen.hpp
	gui/wdgScreen.cpp
	gui/wdgScreen.hpp
	gui/wdgSettingsAudio.cpp
	gui/wdgSettingsAudio.hpp
	gui/wdgSettingsCheats.cpp
	gui/wdgSettingsCheats.hpp
	gui/wdgSettingsGeneral.cpp
	gui/wdgSettingsGeneral.hpp
	gui/wdgSettingsInput.cpp
	gui/wdgSettingsInput.hpp
	gui/wdgSettingsPPU.cpp
	gui/wdgSettingsPPU.hpp
	gui/wdgSettingsRecording.cpp
	gui/wdgSettingsRecording.hpp
	gui/wdgSettingsVideo.cpp
	gui/wdgSettingsVideo.hpp
	gui/wdgState.cpp
	gui/wdgState.hpp
	gui/wdgStatusBar.cpp
	gui/wdgStatusBar.hpp
	gui/theme.cpp
	gui/theme.hpp
	gui/wdgTitleBarWindow.cpp
	gui/wdgTitleBarWindow.hpp
	gui/wdgToolBar.cpp
	gui/wdgToolBar.hpp

	$<IF:$<BOOL:${ENABLE_OPENGL}>,
		gui/wdgOpenGL.cpp
		gui/wdgOpenGL.hpp,
		gui/wdgD3D9.cpp
		gui/wdgD3D9.hpp
	>

	$<$<PLATFORM_ID:Windows>:
		$<$<BOOL:${ENABLE_FULLSCREEN_RESFREQ}>:gui/windows/monitor.c>
		gui/windows/os_jstick.c
		gui/windows/resources.rc
	>

	$<$<PLATFORM_ID:FreeBSD,OpenBSD>:
		gui/bsd/os_jstick.c
	>

	$<$<PLATFORM_ID:Linux>:
		gui/linux/os_jstick.c
	>

	$<$<AND:$<PLATFORM_ID:FreeBSD,OpenBSD,Linux>,$<BOOL:${ENABLE_FULLSCREEN_RESFREQ}>>:
		gui/linux/monitor.c
	>
	)

set(video_srcs
	video/effects/pause.c
	video/effects/tv_noise.c
	video/filters/hq2x.c
	video/filters/hq3x.c
	video/filters/hq4x.c
	video/filters/hqx.c
	video/filters/nes_ntsc.c
	video/filters/ntsc.c
	video/filters/ntsc_bisqwit.c
	video/filters/ntsc_lmp88959.c
	video/filters/ntsc_nesrgb_lmp88959.c
	video/filters/pal_lmp88959.c
	video/filters/pal_nesrgb_lmp88959.c
	video/filters/scale.c
	video/filters/scale2x.c
	video/filters/scalers.c
	video/filters/xBRZ.c
	video/gfx.c
	$<$<BOOL:${ENABLE_FULLSCREEN_RESFREQ}>:
		video/gfx_monitor.c
	>
	video/gfx_thread.c
	video/shaders/shaders.c
	$<IF:$<BOOL:${ENABLE_OPENGL}>,
		video/opengl/glew/glew.c
		video/opengl/gfx_api.c
		video/opengl/opengl.c,
		video/d3d9/d3d9.c
		video/d3d9/gfx_api.c
	>
	)

add_executable(punes
	${audio_srcs}
	${core_srcs}
	${c++_srcs}
	${extra_srcs}
	${gui_ui_srcs}
	${gui_srcs}
	${video_srcs}
	${CMAKE_CURRENT_BINARY_DIR}/translations.qrc
	$<$<PLATFORM_ID:Windows>:gui/windows/resources.rc>
	)

target_include_directories(punes
	PRIVATE
	.
	audio
	core
	gui
	$<IF:$<BOOL:${ENABLE_OPENGL}>,
		${CMAKE_CURRENT_SOURCE_DIR}/video/opengl,
		${CMAKE_CURRENT_SOURCE_DIR}/video/d3d9
	>
	video/shaders
	"${PROJECT_BINARY_DIR}"
	$<$<PLATFORM_ID:FreeBSD,OpenBSD>:${CMAKE_CURRENT_SOURCE_DIR}/gui/bsd>
	$<$<PLATFORM_ID:Linux>:${CMAKE_CURRENT_SOURCE_DIR}/gui/linux>
	$<$<PLATFORM_ID:Windows>:
		${CMAKE_CURRENT_SOURCE_DIR}/gui/windows
		${CMAKE_CURRENT_SOURCE_DIR}/extra/windows/Cg/include
		${CMAKE_CURRENT_SOURCE_DIR}/extra/windows/DSDK/Include
		${CMAKE_CURRENT_SOURCE_DIR}/extra/windows/DSDK/vc10/include
	>
	)

target_link_options(punes
	PRIVATE
	$<$<PLATFORM_ID:Windows>:
		-static-libgcc
		-static-libstdc++
		$<$<BOOL:${ENABLE_RELEASE}>:-Wl,-subsystem,windows>
		$<$<NOT:$<BOOL:${ENABLE_RELEASE}>>:-Wl,-subsystem,console>
		$<IF:$<STREQUAL:${HOST_CPU},i386>,
			-L${CMAKE_CURRENT_SOURCE_DIR}/extra/windows/Cg/lib,
			-L${CMAKE_CURRENT_SOURCE_DIR}/extra/windows/Cg/lib.x64
		>
	>
	)

target_link_libraries(punes
	${QT_LIBS_USED}
	Threads::Threads
	$<$<BOOL:${ENABLE_FFMPEG}>:PkgConfig::LIBAV>
	$<$<PLATFORM_ID:FreeBSD,OpenBSD>:Sndio::Sndio>
	$<$<PLATFORM_ID:FreeBSD,OpenBSD>:UsbHid::UsbHid>
	$<$<PLATFORM_ID:Linux>:ALSA::ALSA>
	$<$<PLATFORM_ID:Linux>:PkgConfig::UDEV>
	${WIN_LIBS_USED}
	$<$<BOOL:${X11_FOUND}>:X11::Xrandr>
	OpenGL::GL
	$<$<AND:$<PLATFORM_ID:FreeBSD,OpenBSD,Linux>,$<BOOL:${ENABLE_OPENGL_CG}>>:Cg::CgGL>
	lib7zip
	qkeycode
	)

target_compile_options(punes
	PRIVATE
	#-Wall
	#-Wextra
	-ffast-math
	)

# warnings disabled for this
target_compile_options(lib7zip PRIVATE -w)
set_source_files_properties(core/patcher_xdelta3_wrap.c PROPERTIES COMPILE_OPTIONS -w)

target_compile_definitions(punes
	PRIVATE
	$<$<BOOL:${ENABLE_GIT_INFO}>:WITH_GIT_INFO>
	$<$<BOOL:${ENABLE_RELEASE}>:RELEASE>
	$<$<BOOL:${ENABLE_FFMPEG}>:WITH_FFMPEG>
	$<$<BOOL:${DISABLE_PORTABLE_MODE}>:WITHOUT_PORTABLE_MODE>
	$<IF:$<BOOL:${ENABLE_OPENGL}>,
		GLEW_STATIC
		WITH_OPENGL,
		WITH_D3D9
	>
	$<$<BOOL:${ENABLE_OPENGL_CG}>:WITH_OPENGL_CG>
	$<$<BOOL:${ENABLE_FULLSCREEN_RESFREQ}>:FULLSCREEN_RESFREQ>
	)

# Ship it!
install(TARGETS punes RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
